package com.mybatis.spring;

import org.springframework.beans.factory.FactoryBean;

public class MapperFactoryBean implements FactoryBean<Object> {
	private Class<?> interfaceClass;

	public Class<?> getInterfaceClass() {
		return interfaceClass;
	}

	public void setInterfaceClass(Class<?> interfaceClass) {
		this.interfaceClass = interfaceClass;
	}

	@Override
	public Object getObject() throws Exception {
		return new MapperProxy().getMapper(interfaceClass);
	}

	@Override
	public Class<?> getObjectType() {
		return interfaceClass;
	}

	@Override
	public boolean isSingleton() {
		return true;
	}
}